# Contributor: Daniel Sabogal <dsabogalcc@gmail.com>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=msgpack-c
pkgver=6.0.0
pkgrel=0
pkgdesc="An efficient object serialization library for C"
url="https://msgpack.org"
arch="all"
license="BSL-1.0"
makedepends="cmake samurai"
checkdepends="gtest-dev zlib-dev"
subpackages="$pkgname-dev"
source="https://github.com/msgpack/msgpack-c/releases/download/c-$pkgver/msgpack-c-$pkgver.tar.gz"

build() {
	cmake -G Ninja -B build . \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_VERBOSE_MAKEFILE=TRUE \
		-DMSGPACK_BUILD_TESTS="$(want_check && echo ON || echo OFF)"
	cmake --build build
}

check() {
	cmake --build build --target test
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
77a2a3c984e04fcda298ae34571b6826f1d4f6e53b5f7166992269421ae3153b986ed69ba0360347920047e38f6941680bc9e38563ec79f15591bf8d66cd7978  msgpack-c-6.0.0.tar.gz
"
